#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long;
const int maxn = 2e5+10;
int a[maxn];
int b[maxn];
int suf[maxn]
int pre[maxn];
int n;

bool solve()
{
    int id=-1;
    for(int i=1;i<n;i++)
	{
        if(a[i]<a[i+1])
		{
            id=i;
			break;
        }
    }
    if(id==-1)
	{
        return true;
    }
    int f=1;
    a[id+1]-=a[id];
    for(int i=id+1;i<n;i++)
	{
        if(a[i]>a[i+1])
		{
            f=0;
			break;
        }
    }
    if(f) return true;
    else return false;
}
void init1()
{
		scanf("%d",&n);
        for(int i=1;i<=n;i++) 
		{
			scanf("%d",&a[i]);
			b[i]=a[i];
		}
        suf[n]=a[n];pre[1]=a[1];
        for(int i=n-1;i>=1;i--)
		{
			suf[i]=min(suf[i+1],a[i]);
		}
	
}
void hahah()
{
	
	for(int i=2;i<=n;i++)
	{
		pre[i]=min(pre[i-1],a[i]);
	}
    int now=a[1],flag=1;
}
void wwh()
{
	
	 for(int i=2;i<n;i++)
	{
        if(now + suf[i+1]<a[i])
		{
            flag=0;break;
        }
        if(now >=a[i])
		{
            now = min(now,a[i]);
        }
        else if(now<a[i])
		{
            int tmp=min(now,a[i]);
            now=min(tmp,a[i+1]-a[i]+now);
        }
    }
}
void wohennanshou()
{
	 for(int i=1;i<=n;i++) 
		{
			a[i]=b[i];
		}
        reverse(a+1,a+n+1);
        check2 = solve();
        if(flag || check1 || check2) 
		{
			printf("YES\n");
		}
        else printf("NO\n");
} 
int main()
{

    int T;scanf("%d",&T);
    while(T--)
	{
		init1();
    	hahah();
        wwh();
        int check1 = solve();
		int check2;
		wohennanshou();
    }
    return 0;
}
